package dhee.wtqshopproject.utils;

import dhee.wtqshopproject.dao.AddressMapper;
import dhee.wtqshopproject.entity.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class AddressUtils {
    private static AddressUtils addressUtils;
      @Autowired
    private AddressMapper addressMapper;

    @PostConstruct
    public void init() {
        addressUtils = this;
        addressUtils.addressMapper = addressMapper;
    }
      public static Address getAddressByID(Integer  userId) {
          Address address = addressUtils.addressMapper.selectAddressById(userId);
          return address;
      }
  public  static int insertAddress(Address address){
          return addressUtils.addressMapper.insertAddress(address);
  }

}
